package com.xmy.cultivate.mapper;

import com.xmy.cultivate.entity.RatePay;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2023-06-06
 */
public interface RatePayMapper extends BaseMapper<RatePay> {

    @Select({
            "<script>",
            "SELECT",
            "t1.id ",
            "FROM ",
            "`rate_pay` AS t1 ",
            "INNER JOIN order_detail AS t2 ON t1.order_detail_id = t2.id ",
            "WHERE",
            "t1.year_part = ${yearPart} ",
            "AND t1.quarter_num = ${quarterNum} ",
            "AND t1.student_id = ${studentId} ",
            "AND t1.subjects_id = ${subjectsId} ",
            "AND t2.use_course_count = 0 ",
            "</script>"
    })
    public abstract List<Long> getIdsByUseCourseCount(@Param("studentId") Long studentId, @Param("subjectsId") Long subjectsId, @Param("yearPart") Integer yearPart, @Param("quarterNum") Integer quarterNum);



}
